Class BaseSimulatedSensor<TUNIT>
A base class for simple simulated single-unit sensors
Assembly: Meadow.Foundation.dll
View Source
public abstract class BaseSimulatedSensor<TUNIT> : ISimulatedSensor where TUNIT : struct, IComparable
Derived:
Meadow.Foundation.Sensors.SimulatedLightSensor
Implements:
Meadow.Peripherals.Sensors.ISimulatedSensor
Properties
ZeroCondition
Gets the zero condition for the snsor unit
View Source
public abstract TUNIT ZeroCondition { get; }
RandomWalkRange
The upper/lower bound for a random walk
View Source
protected abstract double RandomWalkRange { get; }
SawtoothStepAmount
The step amount for a sawtooth simulation
View Source
protected abstract double SawtoothStepAmount { get; }
SupportedBehaviors
Gets an array of supported simulation behaviors for the sensor.
View Source
public SimulationBehavior[] SupportedBehaviors { get; }
ValueType
Gets the type of the sensor's value.
View Source
public Type ValueType { get; }
UpdateInterval
View Source
public TimeSpan UpdateInterval { get; }
IsSampling
View Source
public bool IsSampling { get; }
CurrentCondition
View Source
protected TUNIT? CurrentCondition { get; }
Methods
IncrementCondition(TUNIT)
Gets a condition incremented by a step value (used for interrupt value changes)
View Source
protected abstract TUNIT IncrementCondition(TUNIT currentCondition)
Returns
<TUNIT>
Parameters
Type | Name | Description |
---|---|---|
<TUNIT> | currentCondition | The initial value to increment |
DecrementCondition(TUNIT)
Gets a condition decremented by a step value (used for interrupt value changes)
View Source
protected abstract TUNIT DecrementCondition(TUNIT currentCondition)
Returns
<TUNIT>
Parameters
Type | Name | Description |
---|---|---|
<TUNIT> | currentCondition | The initial value to decrement |
IncrementCondition(TUNIT, double)
Gets a condition incremented by the provided root value amount
View Source
protected abstract TUNIT IncrementCondition(TUNIT currentCondition, double conditionDelta)
Returns
<TUNIT>
Parameters
Type | Name | Description |
---|---|---|
<TUNIT> | currentCondition | The initial value to increment |
System.Double | conditionDelta | The delta to increment by |
DecrementCondition(TUNIT, double)
Gets a condition decremented by the provided root value amount
View Source
protected abstract TUNIT DecrementCondition(TUNIT currentCondition, double conditionDelta)
Returns
<TUNIT>
Parameters
Type | Name | Description |
---|---|---|
<TUNIT> | currentCondition | The initial value to decrement |
System.Double | conditionDelta | The delta to decrement by |
Read()
View Source
public Task<TUNIT> Read()
Returns
System.Threading.Tasks.Task<<TUNIT>>
StartUpdating(TimeSpan?)
Starts updating the sensor value at the specified interval
View Source
public void StartUpdating(TimeSpan? updateInterval = null)
Parameters
Type | Name |
---|---|
System.Nullable<System.TimeSpan> | updateInterval |
StopUpdating()
Stops updating the sensor
View Source
public void StopUpdating()
SetSensorValue(object)
Sets the simulated value for the sensor.
View Source
public void SetSensorValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to set for the sensor. |
StartSimulation(SimulationBehavior)
Starts the simulation with the specified behavior.
View Source
public void StartSimulation(SimulationBehavior behavior)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Peripherals.Sensors.SimulationBehavior | behavior | The simulation behavior to start. |
Events
Updated
View Source
public event EventHandler<IChangeResult<TUNIT>> Updated
Event Type
System.EventHandler<Meadow.IChangeResult<<TUNIT>>>
Implements
Meadow.Peripherals.Sensors.ISimulatedSensor